<?php

use yii\db\Migration;

/**
 * Class m171214_033404_user_package
 */
class m171214_033404_user_package extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $tableOptions = null;
        if ( $this->db->driverName === 'mysql' )
        {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
        }

        // Create user-package table
        $this->createTable('user_package', array(
            'id'                 => 'pk',
            'package_id'         => 'int not null',
            'user_id'             => 'int not null',
            'created_at'         => 'int not null',
            'updated_at'         => 'int not null',
        ), $tableOptions);
    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        echo "m171214_033404_user_package cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171214_033404_user_package cannot be reverted.\n";

        return false;
    }
    */
}
